package VisaoControleAcademico;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;

import ControleAcamico.ControlePrincipal;

public class ViewCurso extends JFrame {
	private JPanel panl, panl1, panl2;
	private JLabel labNomeCurso, labCronogr, labValor, labQntdHoras;
	private JButton botnCadstro, botnLimpar;
	public static JTextField NomeCurso;
	public static JTextField cronograAulas;
	public static JTextField QntdHoras;
	public static JTextField Valor;
	public static JList listaProfessor;
	private ControlePrincipal controle;

	public ViewCurso(ControlePrincipal controle) {
		super("Cadastro de Curso");
		this.controle = controle;
		init();
		adicionar();
		excutar();
	}

	private void adicionar() {
		setup();
		panl.add(panl1);
		panl1.add(labNomeCurso);
		panl1.add(NomeCurso);
		panl1.add(labQntdHoras);
		panl1.add(cronograAulas);
		panl1.add(labCronogr);
		panl1.add(QntdHoras);
		panl1.add(labValor);
		panl1.add(Valor);
		panl.add(botnCadstro);
		panl.add(botnLimpar);
		add(panl);
	}

	private void setup() {
		panl.setLayout(new FlowLayout(FlowLayout.CENTER));
		panl1.setLayout(new GridLayout(0, 2, 0, 0));
	}

	private void init() {
		panl = new JPanel();
		panl.setSize(400, 230);
		panl1 = new JPanel();
		panl1.setPreferredSize(new Dimension(370, 140));
		panl1.setBorder(BorderFactory.createTitledBorder(null,
				"CADASTRAMENTO DO CURSO", TitledBorder.CENTER,
				TitledBorder.DEFAULT_JUSTIFICATION));
		labNomeCurso = new JLabel("Nome do curso");
		labCronogr = new JLabel("Cronograma");
		labQntdHoras = new JLabel("Carga Horaria do Curso");
		labValor = new JLabel("Valor Mensal");
		NomeCurso = new JTextField();
		cronograAulas = new JTextField();
		QntdHoras = new JTextField();
		Valor = new JTextField();
		botnCadstro = new JButton("Cadastrar_Curso");
		botnCadstro.addActionListener(controle);
		botnLimpar = new JButton("Limpar Campos");
		botnLimpar.addActionListener(controle);

	}

	private void excutar() {
		setLocationRelativeTo(null);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setSize(400, 250);
	}

	public void mostra() {
		setVisible(true);
	}

	public static void metodoLimparCampoCurso() {
		NomeCurso.setText(null);
		cronograAulas.setText(null);
		QntdHoras.setText(null);
		Valor.setText(null);
	}

}

